<script lang="ts" setup>

  import { Message } from "@arco-design/web-vue";

  export interface userOptions<T> {
    username?: string
    mobile?: string
    company?: string
  }

  const route = useRoute();
  const router = useRouter();
  const userInfo = useCookie("userInfo") || {} as userOptions<any>
  const userToken = useCookie("userToken") || ''

  const menuIndex = ref<string[]>([])
  const showMenu = ref<boolean>(false)
  watch(
      () => route.path,
      (newValue, oValue) => {
        menu(newValue)
      },
  );
  menu(route.path)
  function menu(path: string){
    const index = ref<string[]>([])
    if(path == '/'){
      index.value.push("1")
    }else if(path == '/amazon'){
      index.value.push("2")
    }else if(path == '/describe'){
      index.value.push("3")
    }
    menuIndex.value = index.value
  }

  function jump(path: string){
      navigateTo(path)
      showMenu.value = false
  }

  function openMenu(){
    showMenu.value = !showMenu.value
  }

</script>
<template>
  <a-affix>
  <div class="header-container">
    <div class="header-body">
      <div class="more" @click="openMenu"><icon-menu-unfold size="30" /></div>
      <div @click="jump('/')" class="logo">
        <a-image src="/base/logo.png?1=1" :preview="false"></a-image>
      </div>
      <a-menu class="menu-container" mode="horizontal" :selected-keys="menuIndex">
        <a-menu-item key="1" @click="jump('/')">美客多PDF</a-menu-item>
        <a-menu-item key="2" @click="jump('/amazon')">亚马逊PDF</a-menu-item>
        <a-menu-item key="3" @click="jump('/describe')">操作说明</a-menu-item>

      </a-menu>
      <div class="user-btn">

      </div>
    </div>
  </div>
  </a-affix>
</template>
<style scoped lang="scss">
.header-container{
  height: 72px;
  background: #FFFFFF;
  box-shadow: 0px 4px 16px 0px rgba(47,81,255,0.25);
  border-radius: 0px 0px 0px 0px;
  opacity: 1;
  //position: fixed;
  z-index: 99;
  width: 100%;
  //top: 0;
  .header-body{
    margin: 0 auto;
    max-width: 1200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    position: relative;
    .more{
      display: none;
    }
    .logo{
      cursor: pointer;
    }
    .user-btn{
      //.header-userinfo{
      //  min-width: 170px;
      //  display: flex;
      //  align-items: center;
      //  cursor: pointer;
      //  .headimg{
      //    border-radius: 15px;
      //    margin-right: 10px;
      //  }
      //  .company-name{
      //    max-width: 100px;
      //    overflow: hidden;
      //    white-space: nowrap;
      //    text-overflow: ellipsis;
      //  }
      //  .separate{
      //    margin: 0 5px;
      //  }
      //}
    }
  }
}
@media screen and (max-width: 500px) {
  .header-container .header-body{
    padding: 0 10px;
    justify-content: space-around;
    .more{
      display: block;
      position: absolute;
      left: 20px;
    }
    .menu-container{
      display: none;
    }
    //.user-btn{
    //  display: none;
    //}
  }
}


</style>
